<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Performs a SOAP request</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="soapclient.construct.html">SoapClient::__construct</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="soapclient.getfunctions.html">SoapClient::__getFunctions</a></div>
 <div class="up"><a href="class.soapclient.html">SoapClient</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="soapclient.dorequest" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SoapClient::__doRequest</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.0.1)</p><p class="refpurpose"><span class="refname">SoapClient::__doRequest</span> &mdash; <span class="dc-title">Performs a SOAP request</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-soapclient.dorequest-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><strong>SoapClient::__doRequest</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$request</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$location</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$action</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$version</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$one_way</code><span class="initializer"> = 0</span></span>
  ] )</div>

  <p class="para rdfs-comment">
   Performs SOAP request over HTTP.
  </p>
  <p class="para">
   This method can be overridden in subclasses to implement different transport
   layers, perform additional XML processing or other purpose.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-soapclient.dorequest-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">request</code></em></dt>

     <dd>

      <p class="para">
       The XML SOAP request.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">location</code></em></dt>

     <dd>

      <p class="para">
       The URL to request.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">action</code></em></dt>

     <dd>

      <p class="para">
       The SOAP action.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">version</code></em></dt>

     <dd>

      <p class="para">
       The SOAP version.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">one_way</code></em></dt>

     <dd>

      <p class="para">
       If <em>one_way</em> is set to 1, this method returns nothing. 
       Use this where a response is not expected.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-soapclient.dorequest-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   The XML SOAP response.
  </p>
 </div>

 
 <div class="refsect1 changelog" id="refsect1-soapclient.dorequest-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>5.1.3</td>
       <td>
        The <em><code class="parameter">one_way</code></em> parameter was added.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>



 <div class="refsect1 examples" id="refsect1-soapclient.dorequest-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5195">
    <p><strong>Example #1 <span class="function"><strong>SoapClient::__doRequest()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">Add</span><span style="color: #007700">(</span><span style="color: #0000BB">$x</span><span style="color: #007700">,</span><span style="color: #0000BB">$y</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">$x</span><span style="color: #007700">+</span><span style="color: #0000BB">$y</span><span style="color: #007700">;<br />}<br /><br />class&nbsp;</span><span style="color: #0000BB">LocalSoapClient&nbsp;</span><span style="color: #007700">extends&nbsp;</span><span style="color: #0000BB">SoapClient&nbsp;</span><span style="color: #007700">{<br /><br />&nbsp;&nbsp;function&nbsp;</span><span style="color: #0000BB">__construct</span><span style="color: #007700">(</span><span style="color: #0000BB">$wsdl</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$options</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">parent</span><span style="color: #007700">::</span><span style="color: #0000BB">__construct</span><span style="color: #007700">(</span><span style="color: #0000BB">$wsdl</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$options</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">server&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SoapServer</span><span style="color: #007700">(</span><span style="color: #0000BB">$wsdl</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$options</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">server</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addFunction</span><span style="color: #007700">(</span><span style="color: #DD0000">'Add'</span><span style="color: #007700">);<br />&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;function&nbsp;</span><span style="color: #0000BB">__doRequest</span><span style="color: #007700">(</span><span style="color: #0000BB">$request</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$location</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$action</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$version</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$one_way&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ob_start</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">server</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">handle</span><span style="color: #007700">(</span><span style="color: #0000BB">$request</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$response&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ob_get_contents</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ob_end_clean</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">$response</span><span style="color: #007700">;<br />&nbsp;&nbsp;}<br /><br />}<br /><br /></span><span style="color: #0000BB">$x&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">LocalSoapClient</span><span style="color: #007700">(</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,array(</span><span style="color: #DD0000">'location'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'test://'</span><span style="color: #007700">,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'uri'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'http://testuri.org'</span><span style="color: #007700">));&nbsp;<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$x</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Add</span><span style="color: #007700">(</span><span style="color: #0000BB">3</span><span style="color: #007700">,</span><span style="color: #0000BB">4</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="soapclient.construct.html">SoapClient::__construct</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="soapclient.getfunctions.html">SoapClient::__getFunctions</a></div>
 <div class="up"><a href="class.soapclient.html">SoapClient</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
